package com.wood.life.controller;

import com.night.common.entity.ResultVo;
import com.night.common.entity.life.Answer;
import com.night.common.entity.life.AnswerVo;
import com.night.common.entity.life.Question;
import com.night.common.entity.life.QuestionVo;
import com.rabbitmq.client.Channel;
import com.wood.life.service.AnswerService;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * author: dz
 * 2022-10-18-19:14
 */
@RestController
@RequestMapping("/api/life+/answer")
public class AnswerController {
    @Autowired
    AnswerService answerService;
    @Autowired
    RabbitTemplate rabbitTemplate;
    @RequestMapping("/add")
    public ResultVo add(@RequestBody AnswerVo answerVo) {
        rabbitTemplate.convertAndSend("exchangetopic", "answer", answerVo);
        return new ResultVo<>(200,"queue",answerVo);
    }
}
